//
//  HttpHomePtl.m
//  Cat
//
//  Created by lushitong on 2018/12/19.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "HttpHomePtl.h"
#import "FLRequest.h"
#import "FLTool.h"

#define API_index @"index/get"
#define API_Search @"search/get"
#define API_SearchKey_Word @"search/list"
#define API_search_get @"product/get"

@implementation HttpHomePtl

+ (void)getHomeInfoWithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	[FLRequest GET:[FLTool getFullPath:API_index] parameters:@{} success:success failure:failure];
}

+ (void)getSearchWithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	[FLRequest GET:[FLTool getFullPath:API_Search] parameters:@{} success:success failure:failure];
}

+ (void)searchWithKeyWord:(NSString *)keyWord andIndex:(NSNumber *)index withSuccess:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"keyword":keyWord ? keyWord :@"",
						  @"index":index? index : @(1),
						  @"size" :@(20)
						  };
	[FLRequest GET:[FLTool getFullPath:API_SearchKey_Word] parameters:dic success:success failure:failure];
}

+ (void)getProductId:(NSNumber *)productID WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"productId":productID ? productID : @(0)};
	[FLRequest GET:[FLTool getFullPath:API_search_get] parameters:dic success:success failure:failure];
}

+ (void)getCouponWithProductId:(NSNumber *)productID WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"productId":productID ? productID : @(0)};
	[FLRequest GET:[FLTool getFullPath:@"coupon/get"] parameters:dic success:success failure:failure];
}

+ (void)getShareCouponProductId:(NSNumber *)productID WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"productId":productID ? productID : @(0)};
	[FLRequest GET:[FLTool getFullPath:@"coupon/share/get"] parameters:dic success:success failure:failure];
}

+ (void)getShareInfoProductId:(NSNumber *)productID WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"productId":productID ? productID : @(0)};
	[FLRequest GET:[FLTool getFullPath:@"coupon/share/get"] parameters:dic success:success failure:failure];
}

+ (void)getIndexWithIndex:(NSNumber *)index  WithSuccuss:(FLSuccess)success failure:(FLFailure)failure {
	NSDictionary *dic = @{@"index":index ? index :@(0),@"size":@"20"};
	[FLRequest GET:[FLTool getFullPath:@"index/groom/list"] parameters:dic success:success failure:failure];
}

+ (void)authGetinfoSuccuss:(FLSuccess)success failure:(FLFailure)failure {
    [FLRequest GET:[FLTool getFullPath:@"auth/get"] parameters:@{} success:success failure:failure];
}

@end
